var box2 = echarts.init(document.getElementById('box2'));
function resizeChart(){
    box2.resize()
}
window.addEventListener('resize',resizeChart)
var option;
setTimeout(function () {
option = {
    legend: {},
    tooltip: {
    trigger: 'axis',
    showContent: false
    },
    dataset: {
    source: [
        ['salary', '5千以下', '5千至8千', '8千至1.7万', '1.7万以上'],
        ['专科(高职/高专)', 12, 25, 50, 13],
        ['本科', 3, 17,51, 29],
        ['博士研究生', 6, 17, 44, 33],
        ['硕士研究生', 1, 8, 36, 55]
    ]
    },
    xAxis: { type: 'category' },
    yAxis: { gridIndex: 0 },
    grid: { top: '55%' },
    series: [
    {
        type: 'line',
        smooth: true,
        seriesLayoutBy: 'row',
        emphasis: { focus: 'series' }
    },
    {
        type: 'line',
        smooth: true,
        seriesLayoutBy: 'row',
        emphasis: { focus: 'series' }
    },
    {
        type: 'line',
        smooth: true,
        seriesLayoutBy: 'row',
        emphasis: { focus: 'series' }
    },
    {
        type: 'line',
        smooth: true,
        seriesLayoutBy: 'row',
        emphasis: { focus: 'series' }
    },
    {
        type: 'pie',
        id: 'pie',
        radius: '30%',
        center: ['50%', '31%'],
        emphasis: {
        focus: 'self'
        },
        encode: {
        itemName: 'salary'
        }
    }
    ]
};
box2.showLoading({
    text:'经过折线图才有变化噢~...'
});
box2.on('updateAxisPointer', function (event) {
    const xAxisInfo = event.axesInfo[0];
    if (xAxisInfo) {
    const dimension = xAxisInfo.value + 1;
    box2.setOption({
        series: {
        id: 'pie',
        label: {
            formatter: '{b}:{d}%'
        },
        encode: {
            value: dimension,
            tooltip: dimension
        }
        }
    });
    }
    box2.hideLoading()
});
box2.setOption(option);
});
option && box2.setOption(option);